package com.eudon.design_pattern.behavioral.mediator;

/**
 * @author eudon
 * @description 具体用户实现
 * @date 2025/9/3
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
public class ConcreteUser extends User {
    
    public ConcreteUser(String name, Mediator mediator) {
        super(name, mediator);
    }
    
    @Override
    public void sendMessage(String message) {
        System.out.println(name + " 发送消息: " + message);
        // 通过中介者发送消息
        mediator.sendMessage(message, this);
    }
    
    @Override
    public void receiveMessage(String message, String from) {
        System.out.println(name + " 收到来自 " + from + " 的消息: " + message);
    }
}